import { marketPlaceList } from '@/utils/globalData'

interface objType {
  value?: string
  label?: string
  name?: string
}

export const stockOptions = (isSearch?: Boolean) => {
  let arr = [
    { label: '成品', value: '成品' },
    { label: '样品', value: '样品' },
    { label: '半成品', value: '半成品' },
    { label: '配件', value: '配件' },
    { label: '混合', value: '混合' },
    { label: '其他', value: '其他' },
  ]
  let obj = { label: '存货类型', value: '' }
  isSearch ? arr.unshift(obj) : ''
  return arr
}

export const siteSearchList = () => {
  let arr = []
  let newObj: any = marketPlaceList
  for (const key in newObj) {
    let obj: objType = {}
    obj.value = key
    obj.label = newObj[key].code
    obj.name = newObj[key].name
    arr.push(obj)
  }
  arr.unshift({ label: '可补货站点', value: '' })
  return arr
}
